#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>

int callback(void *p, int argc, char **argv, char **argv) {
	    int i;
	        *(int *)p = 0;
		    for (i = 0; i < argc; i++)
			            printf("%s=%s ", argv[i], argv[i] ? argv[i] : "NULL");
		        putchar('\n');
			    return 0;
}

int main() {
	    sqlite3 *db;
	        char *err = 0;
		    int ret = 0;
		        int empty = 1;

			    ret = sqlite3_open("test.db", &db);
			        if (ret != SQLITE_OK) {
					        fprintf(stderr, "无法打开数据库: %s\n", sqlite3_errmsg(db));
						        exit(1);
							    }

				    ret = sqlite3_exec(db, "select * from employee;", callback, &empty, &err);
				        if (ret != SQLITE_OK) {
						        fprintf(stderr, "SQL错误: %s\n", err);
							        sqlite3_free(err);
								    }

					    sqlite3_close(db);
					        return 0;
}
